tooling: Consolidate configuration in pyproject.toml.#227
Conversation
There was a problem hiding this comment.
Pull request overview
Centralizes Python tooling configuration into pyproject.toml (pytest + ruff/isort) and applies repository-wide import sorting via Ruff’s isort rules, reducing standalone config files and keeping linting consistent.
Changes:
- Move
pytest.inisettings into[tool.pytest.ini_options]inpyproject.tomland deletepytest.ini. - Enable Ruff’s isort (
I) rules and add Ruff isort configuration for MicroPython imports. - Auto-fix import ordering across tests, libraries, and examples.
Reviewed changes
Copilot reviewed 69 out of 69 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Adds [project] metadata; migrates pytest config; enables Ruff isort and updates lint config/comments. |
pytest.ini |
Removes legacy pytest config file. |
tests/conftest.py |
Import ordering only. |
tests/test_scenarios.py |
Import ordering only. |
tests/runner/executor.py |
Import ordering/grouping (including within function). |
lib/wsen-pads/wsen_pads/device.py |
Import ordering only. |
lib/wsen-pads/examples/test.py |
Import ordering only. |
lib/wsen-pads/examples/one_shot_reader.py |
Import ordering only. |
lib/wsen-pads/examples/continuous_reader.py |
Import ordering only. |
lib/wsen-pads/examples/basic_reader.py |
Import ordering only. |
lib/wsen-pads/examples/altitude.py |
Import ordering only. |
lib/wsen-hids/wsen_hids/device.py |
Import ordering only. |
lib/wsen-hids/examples/one_shot_mode.py |
Import ordering only. |
lib/wsen-hids/examples/full_test.py |
Import ordering only. |
lib/wsen-hids/examples/continuous_mode.py |
Import ordering only. |
lib/vl53l1x/examples/distance.py |
Import ordering only. |
lib/steami_config/steami_config/device.py |
Whitespace cleanup near imports. |
lib/steami_config/examples/show_config.py |
Import ordering only. |
lib/steami_config/examples/calibrate_temperature.py |
Import ordering only. |
lib/ssd1327/ssd1327/device.py |
Import ordering/blank line placement. |
lib/ssd1327/examples/shades.py |
Import spacing cleanup. |
lib/ssd1327/examples/rotation.py |
Import ordering only. |
lib/ssd1327/examples/rotating_3d_cube.py |
Import ordering only. |
lib/ssd1327/examples/random_pixels.py |
Import spacing cleanup. |
lib/ssd1327/examples/micropython_logo.py |
Import spacing cleanup. |
lib/ssd1327/examples/lookup_table.py |
Import ordering only. |
lib/ssd1327/examples/invert.py |
Import ordering only. |
lib/ssd1327/examples/illusion.py |
Import spacing cleanup. |
lib/ssd1327/examples/hello_world.py |
Import spacing cleanup. |
lib/ssd1327/examples/framebuf_text.py |
Import spacing cleanup. |
lib/ssd1327/examples/framebuf_scroll.py |
Import ordering only. |
lib/ssd1327/examples/framebuf_rects.py |
Import spacing cleanup. |
lib/ssd1327/examples/framebuf_pixels.py |
Import ordering only. |
lib/ssd1327/examples/framebuf_lines.py |
Import ordering only. |
lib/ssd1327/examples/bitmap.py |
Import spacing cleanup. |
lib/mcp23009e/mcp23009e/pin.py |
Import spacing cleanup. |
lib/mcp23009e/mcp23009e/device.py |
Import ordering/spacing cleanup. |
lib/mcp23009e/mcp23009e/__init__.py |
Import ordering only. |
lib/mcp23009e/examples/test_pin_irq.py |
Import ordering only. |
lib/mcp23009e/examples/test_pin.py |
Import ordering only. |
lib/mcp23009e/examples/test_output_active_low.py |
Import ordering only. |
lib/mcp23009e/examples/test_output.py |
Import ordering only. |
lib/mcp23009e/examples/test_led_simple.py |
Import ordering only. |
lib/mcp23009e/examples/test_interrupts.py |
Import ordering only. |
lib/mcp23009e/examples/test_basic.py |
Import ordering only. |
lib/mcp23009e/examples/i2c_scan.py |
Import formatting (I2C, Pin) and spacing. |
lib/mcp23009e/examples/buttons.py |
Import ordering only. |
lib/lis2mdl/lis2mdl/device.py |
Import ordering only. |
lib/lis2mdl/examples/magnet_test.py |
Import ordering only. |
lib/lis2mdl/examples/magnet_fieldForce.py |
Import ordering only. |
lib/lis2mdl/examples/magnet_compass.py |
Import ordering only. |
lib/ism330dl/ism330dl/__init__.py |
Import ordering only. |
lib/ism330dl/examples/static_orientation.py |
Import ordering only. |
lib/ism330dl/examples/motion_orientation.py |
Import ordering only. |
lib/ism330dl/examples/basic_read.py |
Import ordering only. |
lib/hts221/hts221/device.py |
Import ordering/spacing cleanup. |
lib/hts221/examples/humidity.py |
Import ordering only. |
lib/daplink_flash/examples/write_csv.py |
Import ordering only. |
lib/daplink_flash/examples/sensor_log.py |
Import ordering only. |
lib/daplink_flash/examples/read_file.py |
Import ordering only. |
lib/daplink_flash/examples/flash_info.py |
Import ordering only. |
lib/daplink_flash/examples/erase_flash.py |
Import ordering only. |
lib/daplink_flash/examples/config_zone.py |
Import ordering/spacing cleanup. |
lib/bq27441/examples/fuel_gauge.py |
Import ordering only. |
lib/bq27441/bq27441/device.py |
Import ordering/grouping cleanup. |
lib/apds9960/examples/proximity.py |
Import ordering only. |
lib/apds9960/examples/gesture.py |
Import ordering only (including from ... import (...) name order). |
lib/apds9960/examples/ambient_light.py |
Import ordering only. |
lib/apds9960/apds9960/device.py |
Import ordering/spacing cleanup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name = "micropython-steami-lib" | ||
| version = "0.1.0" | ||
| description = "MicroPython driver library for the STeaMi board." | ||
| license = {text = "MIT"} | ||
| requires-python = ">=3.7" |
There was a problem hiding this comment.
[project].license is set to MIT, but the repository LICENSE file (and README) indicate GPL v3. This makes the central metadata incorrect and could mislead tooling/compliance checks. Update the license field to match the repo’s actual license (e.g., reference the LICENSE file or use a GPL v3 identifier).
There was a problem hiding this comment.
Fixed in ed8b79f. Changed to GPL-3.0-or-later to match the LICENSE file.
| [tool.pytest.ini_options] | ||
| testpaths = ["tests"] | ||
| markers = [ | ||
| "mock: tests using FakeI2C (no hardware needed)", | ||
| "hardware: tests requiring a real board (use --port)", |
There was a problem hiding this comment.
The marker definitions here overlap with (and differ from) the marker registration done in tests/conftest.py (which also defines a board marker). To keep configuration centralized and avoid drift, consider making pyproject.toml the single source of truth (include all markers such as board, and/or remove duplicate config.addinivalue_line(...) marker registrations).
There was a problem hiding this comment.
Fixed in ed8b79f. Added the missing board marker to pyproject.toml and removed the duplicate pytest_configure() marker registrations from conftest.py. pyproject.toml is now the single source of truth for markers.
|
🎉 This PR is included in version 0.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Closes #226
Centralizes project configuration in
pyproject.tomland cleans up redundant files.Changes
Commit 1: Consolidate configuration
pytest.ini→[tool.pytest.ini_options]in pyproject.toml, deletepytest.ini[project]section with name, version, description, license, urls"I"to ruff select, remove[tool.isort]section# "T20"comment, reorganize select list, add comments on ignore rules[tool.ruff.lint.isort]: Configureknown-third-partyfor micropythonCommit 2: Apply isort ordering
ruff check --fix --select I001Checklist
ruff checkpassespytest tests/ -k mockpasses (164 passed)<scope>: <Description.>format